import {getNavigationLink} from '@/api/menu-navigation';
import {getSiteId} from '@/utils/auth';
const theme = {
    state: {
        tableHeight: 300,
        projectData: '',
        addCardId: {}, // 要新增的卡片Id
        delCardId: '',
        links: []
    },
    mutations: {
        SET_PROJECT_DATA (state, data) {
            state.projectData = data;
        },
        SET_ADD_CARD_ID (state, data) {
            state.addCardId = data;
        },
        DEL_ADD_CARD_ID (state, data) {
            state.delCardId = data;
        },
        SET_LINKS (state, data) {
            state.links = data;
        },
        SET_TABLE_HEIGHT (state, data) {
            state.tableHeight = data;
        }
    },
    actions: {
        // 获取链接
        GetLinks ({ commit, state, rootState }, data) {
            return new Promise((resolve, reject) => {
                const siteId = rootState.user.siteId;
                getNavigationLink(siteId).then(res => {
                    commit('SET_LINKS', res.data);
                    resolve(res.data);
                });
            });
        }
    }
};

export default theme;
